from dama import Dama
from PIL import Image
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
import time
driver = webdriver.Edge()
driver.get('http://10.59.9.14:7003/')
driver.find_element(By.XPATH,'/html/body/div[1]/div/div[2]/ul/li[1]/a').click()
driver.find_element(By.CLASS_NAME,'regi-input').send_keys('15232008902')
driver.find_element(By.NAME,'password').send_keys('123456')
time.sleep(2)
driver.save_screenshot('A3mall.png')
day1 = driver.find_element(By.XPATH,'/html/body/div[4]/div/div[1]/div[2]/form/div[3]/span[3]/img')
loction=day1.location
size = day1.size
print(loction)
print(size)
left = loction['x']
top = loction['y']
regit=left+size['width']
bottom = top + size['height']
Image = Image.open('A3mall.png')
Image1 = Image.crop((left*1.5,top*1.5,regit*1.5,bottom*1.5))
Image1.save('image3.png')



dm = Dama('15232008902','ma820116','971210')

yzmdm = open('image3.png','rb').read()
jiegou = dm.PostPic(yzmdm,1902)
print(jiegou)
result = jiegou['pic_str']
print(result)

time.sleep(15)